home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / UTILITY / DO1002.ARJ / WRITE.SCR < prev   
Text File  |  1991-12-28  |  2KB  |  55 lines

  1. .pg wi full clr cy
  2.     COMMAND NAME»gray«: »%t«WriteToFile»ye«
  3.  
  4.     /WRITE {handle} ["]{line}[&]["]
  5. /cw
  6.     The »%t«WriteToFile»#« command writes »cy«{line}»#« to the file which
  7.     has been opened for (»ye«W»#«)rite with the indicated »cy«{handle}»#«.
  8.  
  9.     The file must have been opened by the »%t«/OPEN»#« command with a mode
  10.     of (»ye«W»#«)rite or (»ye«A»#«)ppend. If the file is not opened or opened
  11.     in (»re«R»#«)ead mode, the script will abort. »cy«{handle}»#« must be the
  12.     correct one for the opened file.
  13.  
  14.     All variables in »cy«{line}»#« and »cy«{handle}»#« are expanded.  Line must
  15.     be enclosed in double quotes if it contains the separator
  16.     character (»ye«<SPACE>»#«).  If line ends in the ampersand ("»ye«&»#«") then
  17.     a carriage return and line feed will »+re«NOT»#« be added to the
  18.     line.
  19.  
  20. .pg clr
  21.  
  22.     Here is an example.  The commands are displayed before they
  23.     are executed.  Press »bo«<enter>»#« to execute the commands.
  24.  
  25.     First we'll open the file:
  26.  
  27. |/OPEN 1 OUTFILE.TXT W
  28.     Now we'll write a couple of lines to it:
  29.  
  30. |/WRITE 1 "This is the first line in the file."
  31.     »reset«Notice that the second line ends in an »ye«ampersand»#« ("»wh«&»#«"). After
  32.     you press »bo«<enter>»#« to execute the command, you will be
  33.     prompted for your first name.  Because of the ampersand, your
  34.     name will be »gr«appended»#« to the end of this line.
  35.  
  36. |/WRITE 1 "This is the second line, &"
  37. /SET Default NONE
  38. /GETS Name Default "    »wh«What is your first name»re«?»#«" 20
  39. |/WRITE 1 %name.
  40. |/WRITE 1 "The line above was constructed with two /WRITE statements."
  41. |/CLOSE 1
  42. .reset
  43.  
  44.     Now we'll list the file with the »%t«/LIST»#« command.
  45.  
  46. |/LIST OUTFILE.TXT
  47. /ERASE OUTFILE.TXT N
  48. /GOTO WRITEEND
  49. :OPENERROR
  50.     There was some error opening the file. We will not be able
  51.     to perform the demonstration.
  52.  
  53. :WRITEEND
  54. /ENDEXEC
  55.